<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test02</title>
</head>
<body>
<script type="text/javascript">
    let s01 = Symbol();

    console.log(typeof s01);

    let s02 = Symbol();
    let s03 = Symbol();

    console.log(s01 == s02);
    console.log(s01 == s03);

    let f01 = Symbol("f01");
    let f02 = Symbol("f02");

    console.log(f01 == f02);

    console.log(String(s01));
    console.log(String(s02));
    console.log(String(f01));
    console.log(f02.toString());

    console.log(s03);

    let stu = {
        name: "zhangsan",
        age: 18,
        [s01]: "xxx",
        [s02]: "yyy"
    };

    stu[s03] = "zzz";

    console.dir(stu);

    console.log(stu[s01]);
    console.log(stu[s02]);

    let stu02 = {
        name: "zhangsan",
        age: 18,
        [Symbol("xxx")]: "xxx",
        [Symbol("yyy")]: "yyy"
    };

    console.dir(stu02);
    console.dir(stu02[Symbol("xxx")]);

    let stu03 = {
        name: "zhangsan",
        age: 18,
        [Symbol.for("x")]: "xxx",
        [Symbol.for("y")]: "yyy"
    };

    console.dir(stu03);
    console.dir(stu03[Symbol.for("x")]);

    console.log(Symbol.keyFor(s01));
    console.log(Symbol.keyFor(f01));
    console.log(Symbol.keyFor(Symbol.for("x")));

    const MONDAY = Symbol();
    const TUESDAY = Symbol();

    let p01 = MONDAY;

    switch (p01) {
    }

    let arr = ['a', 'b', 'c'];

    console.log(arr instanceof Array);

    class SymbolTest {
        static [Symbol.hasInstance](obj) {
            return true;
        }
    }

    console.log(arr instanceof SymbolTest);

    let arr01 = ['01', '02', '03'];

    arr01[Symbol.isConcatSpreadable] = false;

    console.log(arr.concat(arr01));

</script>
</body>
</html>